<?php
/**
* webappkit core initialization.
* include this file before using any webappkit package (kits)
* <code>
* //get webappkit core libraries
* include('webappkit/webappkit.wak/wak.init.php');
* // get a library kit
* webappkit::loadKit('webappkit/databeans/datetime');
* // you can start using it, any dependances are included
* $now=new dateTimeBean();
* // some kits may also be full application / frameworks
* webappkit::runkit('webappkit/admin');
* // you can also package your application resources as kits
* $myApp=webappkit::getkit('myapp');
* $myModule=$myApp->getService('mymodule');
* $myModule->doSomeStuff();
* </code>
* This file belongs to the core webappkit package (kit)
* @link http://webappkit.net
* @package webappkit
* @author J.Ducastel <jeremie@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
* to be included once
*/
if (defined('WAK_ROOT_PATH'))
	return;
	
/**
* define WAK_START_TIME (microtime)
*/
list($usec, $sec) = explode(" ", microtime());
$microtime=((float)$usec + (float)$sec);
if (!defined('WAK_START_TIME'))
	define('WAK_START_TIME',$microtime);

// defining kits root
// this file should be one level over the root
define('WAK_ROOT_PATH',realpath(dirname(__FILE__).'/../').'/');
// echo WEBAPPKIT_ROOT_PATH;

// getting core libraries
switch (substr(phpversion(),0,1)) {
	case '4':
		// running php4
		if (!class_exists('webappkit'))
			include('webappkit.class.php4');
			include('wakservice.class.php4');
			include('wakstorage.class.php4');
		break;
	case '5':
		// well... running php4 version too.
		include('webappkit.class.php4');
		include('wakservice.class.php4');
			include('wakstorage.class.php4');
		break;
	default:
		trigger_error("unsupported php version ".phpversion(),E_USER_ERROR);
}

// echo "toto";

?>